<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.10"/>
<title>OS系统接口查询手册: OS::threadpool类 参考</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">OS系统接口查询手册
   &#160;<span id="projectnumber">v1.0</span>
   </div>
   <div id="projectbrief">Janisa</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.10 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'搜索');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>首页</span></a></li>
      <li><a href="namespaces.html"><span>命名空间</span></a></li>
      <li class="current"><a href="annotated.html"><span>类</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="搜索" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>类列表</span></a></li>
      <li><a href="classes.html"><span>类索引</span></a></li>
      <li><a href="hierarchy.html"><span>类继承关系</span></a></li>
      <li><a href="functions.html"><span>类成员</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespaceOS.html">OS</a></li><li class="navelem"><a class="el" href="classOS_1_1threadpool.html">threadpool</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public 成员函数</a> &#124;
<a href="#pri-types">Private 类型</a> &#124;
<a href="#pri-attribs">Private 属性</a> &#124;
<a href="classOS_1_1threadpool-members.html">所有成员列表</a>  </div>
  <div class="headertitle">
<div class="title">OS::threadpool类 参考</div>  </div>
</div><!--header-->
<div class="contents">

<p><code>#include &lt;<a class="el" href="threadpool_8h_source.html">threadpool.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public 成员函数</h2></td></tr>
<tr class="memitem:a4bc5b951d669eae7840e3809cd977eb8"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classOS_1_1threadpool.html#a4bc5b951d669eae7840e3809cd977eb8">threadpool</a> (unsigned short size=1)</td></tr>
<tr class="separator:a4bc5b951d669eae7840e3809cd977eb8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9459f9f90abb7f6b40bb2f4cce408e13"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classOS_1_1threadpool.html#a9459f9f90abb7f6b40bb2f4cce408e13">~threadpool</a> ()</td></tr>
<tr class="separator:a9459f9f90abb7f6b40bb2f4cce408e13"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae0ab1d3366da0070a913788140b97221"><td class="memTemplParams" colspan="2">template&lt;class F , class... Args&gt; </td></tr>
<tr class="memitem:ae0ab1d3366da0070a913788140b97221"><td class="memTemplItemLeft" align="right" valign="top">auto&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classOS_1_1threadpool.html#ae0ab1d3366da0070a913788140b97221">commit</a> (F &amp;&amp;f, Args &amp;&amp;...args) -&gt; std::future&lt; decltype(f(args...))&gt;                        </td></tr>
<tr class="separator:ae0ab1d3366da0070a913788140b97221"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a82a1a2fc870d89988dc6c4dc3f471624"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classOS_1_1threadpool.html#a82a1a2fc870d89988dc6c4dc3f471624">idlCount</a> ()</td></tr>
<tr class="separator:a82a1a2fc870d89988dc6c4dc3f471624"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pri-types"></a>
Private 类型</h2></td></tr>
<tr class="memitem:a66991b458ee45ce7fcf0aac2ad4430ec"><td class="memItemLeft" align="right" valign="top">using&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classOS_1_1threadpool.html#a66991b458ee45ce7fcf0aac2ad4430ec">Task</a> = std::function&lt; void()&gt;</td></tr>
<tr class="separator:a66991b458ee45ce7fcf0aac2ad4430ec"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pri-attribs"></a>
Private 属性</h2></td></tr>
<tr class="memitem:a5c5879ca3bdb7441e4bdf27870b75a25"><td class="memItemLeft" align="right" valign="top">std::vector&lt; std::thread &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classOS_1_1threadpool.html#a5c5879ca3bdb7441e4bdf27870b75a25">pool</a></td></tr>
<tr class="separator:a5c5879ca3bdb7441e4bdf27870b75a25"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5fac13408889a4615c2e1eeb70131376"><td class="memItemLeft" align="right" valign="top">std::queue&lt; <a class="el" href="classOS_1_1threadpool.html#a66991b458ee45ce7fcf0aac2ad4430ec">Task</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classOS_1_1threadpool.html#a5fac13408889a4615c2e1eeb70131376">tasks</a></td></tr>
<tr class="separator:a5fac13408889a4615c2e1eeb70131376"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a26f19153d75b1a144e2f3d3bb5de3cc6"><td class="memItemLeft" align="right" valign="top">std::mutex&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classOS_1_1threadpool.html#a26f19153d75b1a144e2f3d3bb5de3cc6">m_lock</a></td></tr>
<tr class="separator:a26f19153d75b1a144e2f3d3bb5de3cc6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac17644ebacd56448631016966a78bdf1"><td class="memItemLeft" align="right" valign="top">std::condition_variable&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classOS_1_1threadpool.html#ac17644ebacd56448631016966a78bdf1">cv_task</a></td></tr>
<tr class="separator:ac17644ebacd56448631016966a78bdf1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aff7091602baba3182351fd55d266e20f"><td class="memItemLeft" align="right" valign="top">std::atomic&lt; bool &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classOS_1_1threadpool.html#aff7091602baba3182351fd55d266e20f">stoped</a></td></tr>
<tr class="separator:aff7091602baba3182351fd55d266e20f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a10ef7583b5e1afaa0828929c753126fa"><td class="memItemLeft" align="right" valign="top">std::atomic&lt; int &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classOS_1_1threadpool.html#a10ef7583b5e1afaa0828929c753126fa">idlThrNum</a></td></tr>
<tr class="separator:a10ef7583b5e1afaa0828929c753126fa"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">成员类型定义说明</h2>
<a class="anchor" id="a66991b458ee45ce7fcf0aac2ad4430ec"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">using <a class="el" href="classOS_1_1threadpool.html#a66991b458ee45ce7fcf0aac2ad4430ec">OS::threadpool::Task</a> =  std::function&lt;void()&gt;</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<h2 class="groupheader">构造及析构函数说明</h2>
<a class="anchor" id="a4bc5b951d669eae7840e3809cd977eb8"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">OS::threadpool::threadpool </td>
          <td>(</td>
          <td class="paramtype">unsigned short&#160;</td>
          <td class="paramname"><em>size</em> = <code>1</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a class="anchor" id="a9459f9f90abb7f6b40bb2f4cce408e13"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">OS::threadpool::~threadpool </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<h2 class="groupheader">成员函数说明</h2>
<a class="anchor" id="ae0ab1d3366da0070a913788140b97221"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class F , class... Args&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">auto OS::threadpool::commit </td>
          <td>(</td>
          <td class="paramtype">F &amp;&amp;&#160;</td>
          <td class="paramname"><em>f</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Args &amp;&amp;...&#160;</td>
          <td class="paramname"><em>args</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> -&gt; std::future&lt;decltype(f(args...))&gt;
        </td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a class="anchor" id="a82a1a2fc870d89988dc6c4dc3f471624"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int OS::threadpool::idlCount </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<h2 class="groupheader">类成员变量说明</h2>
<a class="anchor" id="ac17644ebacd56448631016966a78bdf1"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::condition_variable OS::threadpool::cv_task</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a class="anchor" id="a10ef7583b5e1afaa0828929c753126fa"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::atomic&lt;int&gt; OS::threadpool::idlThrNum</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a class="anchor" id="a26f19153d75b1a144e2f3d3bb5de3cc6"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::mutex OS::threadpool::m_lock</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a class="anchor" id="a5c5879ca3bdb7441e4bdf27870b75a25"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::vector&lt;std::thread&gt; OS::threadpool::pool</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a class="anchor" id="aff7091602baba3182351fd55d266e20f"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::atomic&lt;bool&gt; OS::threadpool::stoped</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a class="anchor" id="a5fac13408889a4615c2e1eeb70131376"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::queue&lt;<a class="el" href="classOS_1_1threadpool.html#a66991b458ee45ce7fcf0aac2ad4430ec">Task</a>&gt; OS::threadpool::tasks</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者 &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.10
</small></address>
</body>
</html>
